package com.blast.sspai.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;

import com.blast.sspai.R;

import java.util.Timer;
import java.util.TimerTask;


/**
 * Created by ibm on 2015/6/16.
 */

/**
 * 意见反馈界面
 */
public class FeedbackActivity extends Activity {

    private EditText editText;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);

        /**
         * 键盘自动弹出
         */
        editText = (EditText) findViewById(R.id.editText);
        editText.setFocusable(true);
        editText.setFocusableInTouchMode(true);
        editText.requestFocus();
        InputMethodManager inputManager =
                (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.showSoftInput(editText, 0);

        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                InputMethodManager m = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
            }
        }, 300);
    }

    /**
     * 意见反馈点击返回
     * @param view
     */
    public void backOnClick(View view) {
        finish();
    }

    public void publishOnClick(View view) {
        //TODO 发布信息
    }
}